#include "test/ContactModel.h"
#include "adr/Metadata/Property.h"
#include "adr/Metadata/Validators/RequiredAttribute.h"
#include "adr/Metadata/Validators/StringLengthAttribute.h"

namespace adr_test {
	using namespace std;

	ContactModel::ContactModel() 
		: name(), phone() {
		auto nameProp = new Property<string>("name", "Name", &this->name);
		nameProp->AddAttribute(new RequiredAttribute());
		nameProp->AddAttribute(new StringLengthAttribute(50));
		this->properties.push_back(nameProp);

		auto phoneProp = new Property<string>("phone", "Phone number", &this->phone);
		phoneProp->AddAttribute(new RequiredAttribute());
		phoneProp->AddAttribute(new StringLengthAttribute(11, 7));
		this->properties.push_back(phoneProp);
	}

	const string& ContactModel::GetName() const {
		return this->name;
	}

	void ContactModel::SetName(const string& value) {
		this->name = value;
	}

	const string& ContactModel::GetPhone() const {
		return this->phone;
	}

	void ContactModel::SetPhone(const string& value) {
		this->phone = value;
	}
}